home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: ResetNews.thor 1.1 (6.10.98)
- © Neil Bothwick
- */
-
- /* Resets the article counters for the current system */
- /* Use it when changing news servers or when the */
- /* server renumbers its articles */
-
- /*;;; Initialise */
- options results
- ;;;
- /* ;;;Needs THOR and bbsread.library functions */
- thorport = address()
- if left(thorport,5) ~= 'THOR.' then do
- say 'CleanSystem.thor must be run from within Thor.'
- exit
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- 'run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead'
- 'WaitForPort BBSREAD'
- end
- ;;;
- /* ;;;Get current system name and data directory */
- address(thorport)
- drop TMP.
- 'CURRENTSYSTEM stem TMP'
- System = TMP.BBSNAME
- address 'BBSREAD'
- drop TMP. CONFLIST.
- 'GETBBSDATA "'system'" stem TMP'
- call pragma('D',TMP.BBSPATH'tcp_tmp')
- ;;;
- /* ;;; Check if n.progress file exists */
- if ~exists('n.progress') then do
- if ~exists('/tcp_tmp.bak/n.progress') then call ExitMsg('This system has no newsgroup list to reset\n'TMP.BBSPATH'tcp_tmp/n.progress not found')
- else address command 'copy /tcp_tmp.bak/n.progress "" clone'
- end
- ;;;
- /* ;;; Reset count for each group to 1 */
- if ~open(infile,'n.progress','R') then call ExitMsg('Error reading n.progress')
- if ~open(outfile,'n.progress.new','W') then call ExitMsg('Error creating new progress file')
- do until eof(infile)
- newsgroup = readln(infile)
- if newsgroup = '' then iterate
- call writeln(outfile,subword(newsgroup,1,1) '1')
- end
- address command 'delete >NIL: /TCPTimestamp.ng'
- ;;;
- /* ;;; Clean up */
- call close(infile)
- call close(outfile)
- if exists('n.progress.old') then call delete('n.progress.old')
- call rename('n.progress','n.progress.old')
- call rename('n.progress.new','n.progress')
- call ExitMsg('After collecting news you may have a number of duplicate messages\nUse Delete Duplicates from the General menu to remove these')
- ;;;
- /* ;;; Exit with a message */
- ExitMsg:
- parse arg ErrTxt
- address(thorport)
- 'REQUESTNOTIFY "'ErrTxt'" " OK "'
- exit
- ;;;
-